<!DOCTYPE html>
<html lang="en" xmlns:th="http://www.thymeleaf.org">
<head>
	<meta charset="UTF-8">
	<meta http-equiv="X-UA-Compatible" content="IE=edge,chrome=1"> 
	<meta name="viewport" content="width=device-width, initial-scale=1.0">
	<title>前台 </title>
	<link th:href="@{/layer/css/layui.css}" rel="stylesheet">
	<link th:href="@{/bootstrap/css/bootstrap.min.css}" rel="stylesheet">
	<link rel="stylesheet" th:href="@{/css/style.css}">
	<style>
		.b_color{
			background-color: #d58512;
		}
		.b_blue{
			background-color: #2D93CA;
		}
		.b_yuding{
			background-color: #dca7a7;
		}
		.b_red{
			background-color: #bb2d3b;
		}
		.b_border{
			border: 1px solid #eee;
		}
		.btn-outline-kaitai {
			 color: #d58512;
			 background-color: transparent;
			 background-image: none;
			 border-color: #d58512;
		}
		.btn-outline-yuding{
			color: #2D93CA;
			background-color: transparent;
			background-image: none;
			border-color: #2D93CA;
		}
		.btn-outline-jiazhan {
			color: #bb2d3b;
			background-color: transparent;
			background-image: none;
			border-color: #bb2d3b;
		}
		.btn-outline-jiazhan:hover {
			color: #fff;
			background-color: #bb2d3b;
			border-color: #bb2d3b;
		}
		.btn-outline-kaitai:hover {
			color: #fff;
			background-color: #d58512;
			border-color: #d58512;
		}
		.btn-outline-yuding:hover {
			color: #fff;
			background-color: #2D93CA;
			border-color: #2D93CA;
		}
	</style>

</head>
<body>
<!--<nav class="navbar navbar-dark bg-dark" style="background-color: #f0ad4e;">-->
<!--	<a class="navbar-brand" href="#">尊敬的： [[${session.Username}]]</a>-->
<!--	<div class="collapse navbar-collapse"  id="navbarTogglerDemo03" >-->
<!--		<ul class="navbar-nav px-3" style="list-style: none; float: right;">-->
<!--			<li class="nav-item text-nowrap">-->
<!--				<a class="navbar-brand" th:href="@{/user/logout}">Sign out</a>-->
<!--			</li>-->
<!--		</ul>-->
<!--	</div>-->
<!--</nav>-->

<div th:replace="~{commons/commons::topdao}"></div>
<div class="container-fluid">
	<div class="row">
	                <div class="col-md-12">
	                    <div class="vertical-tab row" style="min-height: 520px; min-width: 100%" role="tabpanel">
	                        <!-- Nav tabs -->
	                        <ul class="nav nav-tabs" role="tablist">
								<li role="presentation">
									<div class="text-center">
										<img class="mb-4 center-block" th:src="@{/img/lol16.png}" alt="" width="72" height="72">
										<h4>红尘客栈</h4>
									</div>
								</li>
								<li role="presentation" class="active" ><a href="#Section1" aria-controls="home" role="tab" data-toggle="tab">一楼</a></li>
	                            <li role="presentation"><a href="#Section2" aria-controls="profile" role="tab" data-toggle="tab">二楼</a></li>
	                            <li role="presentation"><a href="#Section3" aria-controls="messages" role="tab" data-toggle="tab">三楼</a></li>
	                        </ul>
	                        <!-- Tab panes -->
	                        <div class="tab-content tabs" style="min-width: 85%;">
	                            <div role="tabpanel" class="tab-pane fade in active" id="Section1">
	                                <h3>Section 1</h3>
									<div class="row">
										<div class="col-md-2 text-center " th:each="dins:${din}" th:switch="${dins.getDiningstateid()}"
											 style="border: 1px solid #eee;">
											<div th:case="'1'" th:classappend="b_color">
												<p th:text="${dins.getDiningnumber()}"></p>
												<p th:text="${dins.getDiningtypename()}"></p><!--类型-->
											</div>
											<div th:case="'2'" th:classappend="b_yuding">
												<p th:text="${dins.getDiningnumber()}"></p>
												<p th:text="${dins.getDiningtypename()}"></p><!--类型-->
											</div>
											<div th:case="'3'" th:classappend="b_blue">
												<p th:text="${dins.getDiningnumber()}"></p>
												<p th:text="${dins.getDiningtypename()}"></p><!--类型-->
											</div>
											<div th:case="'4'" th:classappend="b_red">
												<p th:text="${dins.getDiningnumber()}"></p>
												<p th:text="${dins.getDiningtypename()}"></p><!--类型-->
											</div>
										</div>
									</div>
	                            </div>
	                            <div role="tabpanel" class="tab-pane fade" id="Section2">
	                                <h3>Section 2</h3>
									<div class="row">
										<div class="col-md-2 text-center " th:each="dins:${din2}" th:switch="${dins.getDiningstateid()}"
											 style="border: 1px solid #eee;">
											<div th:case="'1'" th:classappend="b_color">
												<p th:text="${dins.getDiningnumber()}"></p>
												<p th:text="${dins.getDiningtypename()}"></p><!--类型-->
											</div>
											<div th:case="'2'" th:classappend="b_yuding">
												<p th:text="${dins.getDiningnumber()}"></p>
												<p th:text="${dins.getDiningtypename()}"></p><!--类型-->
											</div>
											<div th:case="'3'" th:classappend="b_blue">
											<p th:text="${dins.getDiningnumber()}"></p>
											<p th:text="${dins.getDiningtypename()}"></p><!--类型-->
											</div>
											<div th:case="'4'" th:classappend="b_red">
												<p th:text="${dins.getDiningnumber()}"></p>
												<p th:text="${dins.getDiningtypename()}"></p><!--类型-->
											</div>
										</div>
										</div>
	                            </div>
	                            <div role="tabpanel" class="tab-pane fade" id="Section3">
	                                <h3>Section 3</h3>
									<div class="row">
										<div class="col-md-2 text-center " th:each="dins:${din3}" th:switch="${dins.getDiningstateid()}"
											 style="border: 1px solid #eee;">
											<div th:case="'1'" th:classappend="b_color">
												<p th:text="${dins.getDiningnumber()}"></p>
												<p th:text="${dins.getDiningtypename()}"></p><!--类型-->
											</div>
											<div th:case="'2'" th:classappend="b_yuding">
												<p th:text="${dins.getDiningnumber()}"></p>
												<p th:text="${dins.getDiningtypename()}"></p><!--类型-->
											</div>
											<div th:case="'3'" th:classappend="b_blue">
												<p th:text="${dins.getDiningnumber()}"></p>
												<p th:text="${dins.getDiningtypename()}"></p><!--类型-->
											</div>
											<div th:case="'4'" th:classappend="b_red">
												<p th:text="${dins.getDiningnumber()}"></p>
												<p th:text="${dins.getDiningtypename()}"></p><!--类型-->
											</div>
										</div>
									</div>
	                            </div>
	                        </div>

	                    </div>
						<div class="row">
							<div class="col-md-2">
							</div>
							<div class="col-md-2">
							</div>
							<div class="col-md-2">
								<button class="button"  data-toggle="modal" data-target="#exampleModaltable" style="float:left;width: 60px;height: 20px;background-color: #d58512;border:none;" onclick="OutTable()"></button>
								<p th:text="'&nbsp;&nbsp;已开台&nbsp;&nbsp;'+${dinn.getKaiCount()} + '&nbsp;&nbsp;桌'"></p>
							</div>
							<div class="col-md-2" >
								<button class="button"  data-toggle="modal" data-target="#exampleModal1table" style="float:left;width: 60px;height: 20px;background-color: #dca7a7;border:none;" onclick="Restable()"></button>
								<p th:text="'&nbsp;&nbsp;已预定&nbsp;&nbsp;'+${dinn.getYudCount()} + '&nbsp;&nbsp;桌'"></p>
							</div>
							<div class="col-md-2" >
								<div class="" style="float:left;width: 60px;height: 20px;background-color: #2D93CA"></div>
								<p th:text="'&nbsp;&nbsp;空闲&nbsp;&nbsp;'+${dinn.getKonCount()} + '&nbsp;&nbsp;桌'"></p>
							</div>
							<div class="col-md-2">
								<button class="button"  data-toggle="modal" data-target="#exampleModal1tabl"  style="float:left;width: 60px;height: 20px;background-color: #bb2d3b;border:none;" onclick="Tintable()"></button>
								<p th:text="'&nbsp;&nbsp;停用&nbsp;&nbsp;'+${dinn.getTinCount()} + '&nbsp;&nbsp;桌'"></p>
							</div>

						</div>
						<div class="row">
							<div class="col-md-2">
							</div>
							<div class="col-md-2">

							</div>
							<div class="col-md-2">

							</div>
							<div class="col-md-6 text-center">

								<button type="button" class="btn btn-outline-kaitai" data-toggle="modal" data-target="#exampleModal">开台</button>
								<button type="button" class="btn btn-outline-yuding" style="margin: 0 63px ;" data-toggle="modal" data-target="#exampleModal1">预定</button>
								<button type="button" class="btn btn-outline-jiazhan" data-toggle="modal" data-target="#exampleModaltable" onclick="OutTable()">结账</button>

							</div>
						</div>
	                </div>
	            </div>
	        </div>
<!--模态框-->
		<!--模态框  新增开台信息-->
		<div class="modal fade" id="exampleModal" tabindex="-1" role="dialog" aria-labelledby="exampleModalLabel" aria-hidden="true">
			<div class="modal-dialog" role="document">
				<div class="modal-content">
					<div class="modal-header">
						<h5 class="modal-title" id="exampleModalLabel">开台信息</h5>
						<button type="button" class="close" data-dismiss="modal" aria-label="Close">
							<span aria-hidden="true">&times;</span>
						</button>
					</div>
					<div class="modal-body">
						<form th:action="@{/outTable/addOuttable}" method="post">
							<div class="form-group row">
								<label for="" class="col-sm-2 col-form-label">开台人</label>
								<div class="col-sm-10">
									<input type="text"  class="form-control" id="clientnameO" name="clientname">
									<input class="hidden" id="clientid" th:name="clientid" type="text">
								</div>
							</div>
							<div class="form-group row">
								<label for="" class="col-sm-2 col-form-label">联系电话</label>
								<div class="col-sm-5">
									<input type="text"  class="form-control" id="phoneNumberO" name="phoneNumber">
								</div>
								<div class="col-sm-3">
									<button class="btn btn-outline-success my-2 my-sm-0 fr " type="button" onclick="seachclient()">
										<i class="layui-icon layui-icon-search"></i>
									</button>
								</div>
							</div>

							<div class="form-group row">
								<label for="" class="col-sm-2 col-form-label">房台名称</label>
								<div class="col-sm-4">
									<select class="form-control" id="Outfoolr">
										<option th:value="0" th:text="--请选择--"></option>
										<option th:each="foo:${foolr}" th:value="${foo.getFloorsid()}" th:text="${foo.getFloorname()}"></option>
									</select>
								</div>
								<div class="col-sm-4">
									<select class="form-control" name="diningTableid" id="Outdesk">

									</select>
								</div>
							</div>
							<div class="form-group row">
								<label for="staticEmail" class="col-sm-2 col-form-label">人数</label>
								<div class="col-sm-10">
									<input type="text"  class="form-control" id="people" name="people">
								</div>
							</div>
							<div class="form-group row">
								<label for="staticEmail" class="col-sm-2 col-form-label">操作员</label>
								<div class="col-sm-10">
									<input type="text"  class="form-control hidden" id="id0" name="id" th:value="${session.UsernameID}">
									<input type="text"  class="form-control" id="username0" th:value="${session.Username}">
								</div>
							</div>

<!--							<div class="form-group row">-->
<!--								<label for="staticEmail" class="col-sm-2 col-form-label">开台时间</label>-->
<!--								<div class="col-sm-10">-->
<!--									<input type="date"  class="form-control" id="" >-->
<!--								</div>-->
<!--							</div>-->
							<div class="form-group row">
								<button type="submit" class="btn btn-primary col-sm-12">添加</button>
								<button type="button" class="btn btn-secondary col-sm-12" data-dismiss="modal">Close</button>
							</div>

						</form>
					</div>

				</div>
			</div>
		</div>
		<!--模态框  已开台表格-->
		<div class="modal fade" id="exampleModaltable" tabindex="-1" role="dialog" aria-labelledby="exampleModalLabel" aria-hidden="true">
			<div class="modal-dialog" role="document">
				<div class="modal-content">
					<div class="modal-header">
						<h5 class="modal-title" >开台信息</h5>
						<button type="button" class="close" data-dismiss="modal" aria-label="Close">
							<span aria-hidden="true">&times;</span>
						</button>
					</div>
					<div class="modal-body">
						<table id="tabOut" layui-filter="tabOut"></table>
					</div>

				</div>
			</div>
		</div>
		<!--模态框  预约信息-->
		<div class="modal fade" id="exampleModal1" tabindex="-1" role="dialog" aria-labelledby="exampleModalLabel" aria-hidden="true">
			<div class="modal-dialog" role="document">
				<div class="modal-content">
					<div class="modal-header">
						<h5 class="modal-title" >预约信息</h5>
						<button type="button" class="close" data-dismiss="modal" aria-label="Close">
							<span aria-hidden="true">&times;</span>
						</button>
					</div>
					<div class="modal-body">
						<form th:action="@{/reservation/appReservation}" th:method="post">
							<div class="form-group row">
								<label for="staticEmail" class="col-sm-2 col-form-label">预订人</label>
								<div class="col-sm-10">
									<input type="text"  class="form-control" id="clientname" name="clientname">
								</div>
							</div>
							<div class="form-group row">
								<label for="staticEmail" class="col-sm-2 col-form-label">房台名称</label>
								<div class="col-sm-4">
									<select class="form-control" id="foolr">
										<option th:value="0" th:text="--请选择--"></option>
										<option th:each="foo:${foolr}" th:value="${foo.getFloorsid()}" th:text="${foo.getFloorname()}"></option>
									</select>
								</div>
								<div class="col-sm-4">
									<select class="form-control" name="diningTableid" id="desk">

									</select>
								</div>
							</div>
							<div class="form-group row">
								<label for="staticEmail" class="col-sm-2 col-form-label">人数</label>
								<div class="col-sm-10">
									<input type="text"  class="form-control" id="rePeople" name="rePeople">
								</div>
							</div>
							<div class="form-group row">
								<label for="staticEmail" class="col-sm-2 col-form-label">联系电话</label>
								<div class="col-sm-10">
									<input type="text"  class="form-control" id="phoneNumber" name="phoneNumber">
								</div>
							</div>
							<div class="form-group row">
								<label for="staticEmail" class="col-sm-2 col-form-label">备注</label>
								<div class="col-sm-10">
									<input type="text"  class="form-control" id="remark" name="remark" >
								</div>
							</div>
							<div class="form-group row">
								<label for="staticEmail" class="col-sm-2 col-form-label">操作员</label>
								<div class="col-sm-10">
									<input type="text"  class="form-control hidden" id="id" name="id" th:value="${session.UsernameID}">
									<input type="text"  class="form-control" id="username" th:value="${session.Username}">
								</div>
							</div>
							<div class="form-group row">
								<label for="staticEmail" class="col-sm-2 col-form-label">预抵时间</label>
								<div class="col-sm-5">
									<input type="date"  class="form-control" id="Reservatime" name="Reservatime">
								</div>
								<div class="col-sm-5">
									<input type="time"  class="form-control" id="hhmmtime" name="hhmmtime">
								</div>
							</div>
							<div class="form-group row">
								<button type="submit" class="btn btn-primary col-sm-12" >添加</button>
								<button type="button" class="btn btn-secondary col-sm-12" data-dismiss="modal">Close</button>
							</div>

						</form>
					</div>
				</div>
			</div>
		</div>
		<!--模态框  预约表格信息-->
		<div class="modal fade bd-example-modal-lg" id="exampleModal1table" tabindex="-1" role="dialog" aria-labelledby="myLargeModalLabel" aria-hidden="true">
			<div class="modal-dialog modal-lg" role="document">
				<div class="modal-content">
					<div class="modal-header">
						<h5 class="modal-title" >预约信息</h5>
						<button type="button" class="close" data-dismiss="modal" aria-label="Close">
							<span aria-hidden="true">&times;</span>
						</button>
					</div>
					<div class="modal-body">
						<table id="tabRes" layui-filter="tabRes"></table>
					</div>
				</div>
			</div>
		</div>
		<!--模态框  停用表格信息-->
		<div class="modal fade bd-example-modal-lg" id="exampleModal1tabl" tabindex="-1" role="dialog" aria-labelledby="myLargeModalLabel" aria-hidden="true">
	<div class="modal-dialog modal-lg" role="document">
		<div class="modal-content">
			<div class="modal-header">
				<h5 class="modal-title" >停用餐桌信息</h5>
				<button type="button" class="close" data-dismiss="modal" aria-label="Close">
					<span aria-hidden="true">&times;</span>
				</button>
			</div>
			<div class="modal-body">
				<table id="tabstop" layui-filter="tabstop"></table>
			</div>
		</div>
	</div>
</div>

<script type="text/javascript" th:src="@{/js/jquery.min.js}" ></script>
	<script th:src="@{/bootstrap/js/bootstrap.min.js}"></script>
	<script th:src="@{/layer/layui.js}"></script>
<script>
	var tabRestable;//
	var tabOuttable;
	var	tabStop;
var layer;
	$(function () {
		/*预约下拉框*/
		$("#foolr").change(function () {
			var foolrId = $("#foolr").val();
			$.post("/floors/gettableId",{id:foolrId},function (data) {
			$("#desk").empty();
				var n = JSON.parse(data);
				for(var i = 0;i<n.length; i++){
				$("#desk").append('<option value="' + n[i].diningTableid + '">' + n[i].diningnumber + '</option>')
				}
				})
		})
		/*开台下拉框*/
		$("#Outfoolr").change(function () {
			var foolrId = $("#Outfoolr").val();
			$.post("/floors/getOuttableId",{id:foolrId},function (data) {
			$("#Outdesk").empty();
			var n = JSON.parse(data);
			for (var i = 0;i<n.length; i++){
				$("#Outdesk").append('<option value="' + n[i].diningTableid + '">' + n[i].diningnumber + '</option>')
			}
			})
		})

		layui.use(['layer','table'],function () {
			//赋值
			layer = layui.layer,
			layuiTable = layui.table;
			/*已预约表格*/
			tabRestable = layuiTable.render({
				elem: "#tabRes",
				cols: [
						[ //表头
					{ type: 'numbers', title: '序号' },//序号列，title设定标题名称
					{ field: 'reservationid', title: 'ID', hide: true },
					{ field: 'clientname', title: '客户名称', width: 98 },//hide:true 隐藏列
					{ field: 'phoneNumber', title: '电话号码' , width: 142},
					{ field: 'diningnumber', title: '预约餐桌', width: 98 },
					{ field: 'rePeople', title: '人数', width: 58 },
					{ field: 'StoReservatime', title: '预抵时间', width: 124 },
					{ field: 'Sresevationtime', title: '预订时间', width: 124 },
					{ field: 'remark', title: '备注' , width: 58},
					{title: '操作',width: 100, templet: ListRes, align: "center"}
				]
				],
				id: "ListTable",
				page: true,
				data: [],
				height: "full-180",
				limit: 6,
				limits: [6, 12, 18, 24],
				done: function (res, curr) {
				var currPage = curr; // 获得当前页码
				var dataLength = res.data.length; // 获得当前页的记录数
				var count = res.count; // 获得总记录数
				if (dataLength == 0 && count != 0) { //如果当前页的记录数为0并且总记录数不为0
					layuiTable.reload("ListTable", { // 刷新表格到上一页
						page: {
							curr: currPage - 1
						}
					});
				}
			}
			});
			/*已开台表格*/
			tabOuttable = layuiTable.render({
				elem: "#tabOut",
				cols: [
					[ //表头
						{ type: 'numbers', title: '序号' },//序号列，title设定标题名称
						{ field: 'outTableid', title: 'ID', hide: true },
						{ field: 'clientname', title: '客户名称', width: 98 },//hide:true 隐藏列
						{ field: 'phoneNumber', title: '电话号码' , width: 142},
						{ field: 'diningnumber', title: '餐桌', width: 98 },
						{ field: 'people', title: '人数', width: 58 },
						{ field: 'outTime', title: '开台时间', width: 124 },
						 {title: '操作',width: 100, templet: ListOut, align: "center"}
					]
				],
				id: "ListOutTable",
				page: true,
				data: [],
				height: "full-180",
				limit: 5,
				limits: [5, 10, 15,20],
				done: function (res, curr) {
					var currPage = curr; // 获得当前页码
					var dataLength = res.data.length; // 获得当前页的记录数
					var count = res.count; // 获得总记录数
					if (dataLength == 0 && count != 0) { //如果当前页的记录数为0并且总记录数不为0
						layuiTable.reload("ListOutTable", { // 刷新表格到上一页
							page: {
								curr: currPage - 1
							}
						});
					}
				}
			});
			/*停用表格*/
			tabStop = layuiTable.render({
				elem: "#tabstop",
				cols: [
					[ //表头
						{ type: 'numbers', title: '序号' },//序号列，title设定标题名称
						{ field: 'diningTableid', title: 'ID', hide: true, width: 98  },
						{ field: 'floorname', title: '楼层', width: 98 },//hide:true 隐藏列
						{ field: 'diningtypename', title: '类型' , width: 92},
						{ field: 'diningstatename', title: '状态', width: 98 },
						{ field: 'diningnumber', title: '编号', width: 58 },
						 {title: '操作',width: 100, templet: ListStop, align: "center"}
					]
				],
				id: "ListStopTable",
				page: true,
				data: [],
				height: "full-180",
				limit: 8,
				limits: [8, 16, 24, 32],
				done: function (res, curr) {
					var currPage = curr; // 获得当前页码
					var dataLength = res.data.length; // 获得当前页的记录数
					var count = res.count; // 获得总记录数
					if (dataLength == 0 && count != 0) { //如果当前页的记录数为0并且总记录数不为0
						layuiTable.reload("ListStopTable", { // 刷新表格到上一页
							page: {
								curr: currPage - 1
							}
						});
					}
					for (var i = 0; i < dataLength; i++) {
						if (res.data[i].diningstatename == "停用") {
							$("table tbody tr").eq(i).css('background-color', 'rgb(239, 181, 181)')
						}
					}
				}
			});
		});
	});
	/*停用表格更新*/
	function Tintable() {
		tabStop.reload({
			url: "/reservation/Stoptable",
			page: {
				curr: 1
			}

		});
	}
	/*预约表格更新*/
	function Restable() {
		tabRestable.reload({
			url: "/reservation/loadRes",
			page: {
				curr: 1
			}

		});
	}
	/*开台表格更新*/
	function OutTable() {
		tabOuttable.reload({
			url: "/outTable/toOutTable",
			page: {
				curr: 1
			}

		});
	}
	/*自定义预约操作*/
	function ListRes(data) {
		var reservationid = data.reservationid;
		var Numbers = data.diningnumber;
		var btns = "";
		btns +='<button type="button" class="btn btn-warning btn-sm"  style="border: none; margin:3px;height:25px;cursor: pointer;" onclick=openUpdate(' + reservationid +','+Numbers + ')>开台</button>'
		btns +='<button type="button" class="btn btn-danger btn-sm"  style="border: none; margin:3px;height:25px;cursor: pointer;" onclick=opendelect(' + reservationid +')>删除</button>'
		return btns;
	}
	/*自定义停用表格操作*/
	function ListStop(data) {
		var diningid = data.diningTableid;
		var diningstatename = data.diningstatename;
		var Numbers = data.diningnumber;
		var btns = "";
		if (diningstatename == "停用"){
			btns +='<button type="button" class="btn btn-success btn-sm"  style="border: none; margin:3px;height:25px;cursor: pointer;" onclick=Qidong(' + diningid +','+Numbers + ')>启用</button>'
		}
		else{
			btns +='<button type="button" class="btn btn-danger btn-sm"  style="border: none; margin:3px;height:25px;cursor: pointer;" onclick=tingyong(' + diningid +','+Numbers + ')>停用</button>'
		}

		return btns;
	}
	function Qidong(diningid,Numbers) {
		layer.confirm('确认['+Numbers+']启用吗？',{icon: 3, titile: "提示"},function (index) {
			$.post("/reservation/Opentable",{id:diningid},function (data) {
				if (data.code == 0) {
					//成功提示
					layer.msg(data.msg, {icon: 1, time: 2000}, function () {
						//刷新table
						tabStop.reload();
						//关闭confirm
						layer.close(index);
					});
				} else {
					//失败
					layer.msg(data.msg, {icon: 2, time: 3000});
				}
			})
		});
	}
	function tingyong(diningid,Numbers) {
		layer.confirm('确认['+Numbers+']停用吗？',{icon: 3, titile: "提示"},function (index) {
			$.post("/reservation/Stopdintable",{id:diningid},function (data) {
				if (data.code == 0) {
					//成功提示
					layer.msg(data.msg, {icon: 1, time: 2000}, function () {
						//刷新table
						tabStop.reload();
						//关闭confirm
						layer.close(index);
					});
				} else {
					//失败
					layer.msg(data.msg, {icon: 2, time: 3000});
				}
			})
		});
	}
	/*预约————》开台*/
	function openUpdate(reservationid,Numbers) {
		layer.confirm('确认['+Numbers+']开台吗？', { icon: 3, titile: "提示" }, function (index){
			$.post("/reservation/UpdateRes",{id:reservationid},function (data) {
				if (data.code == 0) {
					//成功提示
					layer.msg(data.msg, {icon: 1, time: 2000}, function () {
						//刷新table
						tabRestable.reload();
						//关闭confirm
						layer.close(index);
					});
				} else {
					//失败
					layer.msg(data.msg, {icon: 2, time: 3000});
				}
			})
		});
	}
	/*预约删除*/
	function opendelect(reservationid) {
		layer.confirm('确认将删除吗？', { icon: 3, titile: "提示" }, function (index){
			$.post("/reservation/DelectRes",{id:reservationid},function (data) {
				if (data.code == 0) {
					//成功提示
					layer.msg(data.msg, {icon: 1, time: 2000}, function () {
						//刷新table
						tabRestable.reload();
						//关闭confirm
						layer.close(index);
					});
				} else {
					//失败
					layer.msg(data.msg, {icon: 2, time: 3000});
				}
			})
		});
	}
	/*结账*/
	function ListOut(data) {
		var outTableid = data.outTableid;
		var Numbers = data.diningnumber;
		var btns = "";
		btns +='<button type="button" class="btn btn-warning btn-sm"  style="border: none; margin:3px;height:25px;cursor: pointer;" onclick=ToBill(' + outTableid +','+Numbers + ')>开台</button>'
		return btns;
	}
	function ToBill(outTableid,Numbers) {
		layer.confirm('确认['+Numbers+']结账吗？',{icon: 3, titile: "提示"},function (index) {
			$.post("/reservation/ToOpentable",{id:outTableid},function (data) {
				if (data.code == 0) {
					//成功提示
					layer.msg(data.msg, {icon: 1, time: 2000}, function () {
						//刷新table
						tabStop.reload();
						//关闭confirm
						layer.close(index);
					});
				} else {
					//失败
					layer.msg(data.msg, {icon: 2, time: 3000});
				}
			})
		});
	}
	/*查找会员客户*/
	function seachclient () {
		var zeo = 0;
		var clientname = $("#clientnameO").val();
		var phoneNumber = $("#phoneNumberO").val();
		$.post("/member/getclientId",{ clientname:clientname,
			phoneNumber:phoneNumber
		},function (data) {
			console.log(data);
			if (data == "没有找到"){
				$("#clientid").val(zeo);
				layer.msg("没有找到", {icon: 2, time: 3000});
			}
			else{
				var n = JSON.parse(data);
				$("#clientid").val(n.clientid);
				//$("#identity").val(n.identity);
				layer.msg("是个会员哦", {icon: 1, time: 3000});
			}
		})
	};
</script>

</body>
</html>